<?php

namespace App\Enum;

class OrderEnum implements BasicEnumInterface
{

    const PAY_TYPE_WX = 1;
    const PAY_TYPE_ZFB = 2;
    const PAY_TYPE_STR = 'pay_type';

    const PAY_STATUS_STR = 'pay_status';
    const PAY_STATUS_1 = 1;
    const PAY_STATUS_2 = 2;

    const ORDER_STATUS_STR = 'order_status';
    const ORDER_STATUS_1 = 1;
    const ORDER_STATUS_2 = 2;
    const ORDER_STATUS_3 = 3;
    const ORDER_STATUS_4 = 4;
    const ORDER_STATUS_5 = 5;

    public static function getStrByEnum($enum, $type)
    {
        $payTypeArr = [
            1 => trans('key.pay_type_wx'),
            2 => trans('key.pay_type_zfb')
        ];
        $orderStatusArr = [
            1 => trans('key.order_status_1'),
            2 => trans('key.order_status_2'),
            3 => trans('key.order_status_3'),
            4 => trans('key.order_status_4'),
            5 => trans('key.order_status_5'),
        ];
        $payStatusArr = [
            1 => trans('key.pay_status_1'),
            2 => trans('key.pay_status_2')
        ];
        $statusMap = [
            self::PAY_TYPE_STR => $payTypeArr,
            self::PAY_STATUS_STR => $payStatusArr,
            self::ORDER_STATUS_STR => $orderStatusArr
        ];

        return $statusMap[$type][$enum] ?? null;
    }
}
